<?php

namespace app\index\model;

use think\Model;

class ActivityModel extends Model
{
    // 确定链接表名

    protected $table = 'wb_articles';
    /**
     * 添加活动
     * @param $param
     */
    public function addActivity($param)
    {
        try{
            $result = $this->validate('ActivityValidate')->save($param);
//            halt($result);
            if(false === $result){
                // 验证失败 输出错误信息
                return msg(-1, '', $this->getError());
            }else{
                return msg(1, url('/server'), '添加活动成功');
            }
        }catch (\Exception $e){
            return msg(-2, '', $e->getMessage());
        }
    }
}


